<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="ff" uri="/WEB-INF/firstframe.tld" %>
<%@ taglib prefix="x" uri="/WEB-INF/im.tld" %>
<%
	response.setHeader("Pragma", "No-cache");
	response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
	response.setHeader("Expires", "Sat, 1 Jan 2000 12:00:00 GMT");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html onContextMenu="return false;">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>金蝶协同 - 微门户首页</title>
	<link type="text/css" href="<c:url value="/client/css/portal.css"/>" rel="stylesheet">
	<script type="text/javascript" src="<c:url value="/scripts/admin.js"/>"></script>
	<script type="text/javascript">
		function changePortal(link, id) {
			if ( link.className == "item_title_closed" ) {
				link.className = "item_title_open";
			} else {
				link.className = "item_title_closed";
			}
			var obj = document.getElementById(id);
			if ( obj ) {
				var visible = obj.style.display;
				obj.style.display = visible == "none" ? "block" : "none";
			}
		}
	</script>
</head>
<c:set var="sessionid" value="${sessionid}" /> <%-- 用于产生单点登录链接(ff:ssolink) --%>
<body>
	<div id="portal_main">
		<c:set var="url_setting">${ctx_path}/ucstar.do?method=setting&t=<x:urlencode url="${token}"/>&id=${user.id}</c:set>
		<table border="0" style="font-size:13px; width:100%">
			<tbody>
				<tr>
					<td width="20px">
						<ff:ssolink title="金蝶协同首页" target="_blank" reqFrom="oa" nexturl="/modules/portal/portalService.do?toPage="><img border="0" src="${ctx_path}/client/images/portal_home.png" /></ff:ssolink>	
					</td>
					<td valign="center"><font style="font-weight:bold">金蝶协同</font></td>
					<td align="right" valign="center" style="padding-right:5px;">
						<a id="link_setting" target="_self" href="${url_setting}">定制显示</a>
					</td>
				</tr>
			</tbody>
		</table>
		<div id="portal_content">
			<c:if test="${x:combined(portal_mask, 1) and x:combined(modules, 1)}">
				<c:set var="count" value="${fn:length(workflowFileinboxs)}" />
				<div class="item_title_bg">
					<a class="item_title_closed" href="javascript:void(0);" onclick="changePortal(this, 'item01');">协同审批</a>
					<font class="item_title_count">(${count})</font>
				</div>
				<div class="item_content" id="item01" style="display:none">
					<c:if test="${count gt 0}">
						<ul class="portal_item">
							<c:forEach items="${workflowFileinboxs}" var="x">
								<c:set var="f" value="${x.workflowFile}" />
								<c:set var="m" value="show" />
								<c:if test="${(x.issent eq 2) or (x.issent eq 4)}">
									<c:set var="m" value="edit" />
								</c:if>
								<c:set var="url_desing">${ctx_path}/login/kingdee_sso_login.jsp?DSESSIONID=${sessionid}&from=oahelper&reqFrom=oa&nexturl=<x:urlencode url="/modules/workflow/workflowFileinbox.do?method=design&id=${f.id}&readOnly=true&openwin=true"/></c:set>
								<li>
									<c:if test="${not empty f.priority}">
										<img src="${ctx_path}/client/images/alarmImg${f.priority}.gif" border="0" align="absmiddle" />
									</c:if>
									<img src="${ctx_path}/client/images/viewworkflow.gif" border="0" align="absmiddle" style="cursor:pointer;'" title="显示流程图" onclick="window.open('${url_desing}','_blank','fullscreen=0,status=no');">
									<ff:ssolink cls="link_item" target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/workflow/workflowFileinbox.do?method=${m}&id=${x.id}">${f.title}</ff:ssolink>
									<c:if test="${x.issent eq 1}"><img src="${ctx_path}/client/images/new.gif" /></c:if>
									<font class="small">[${f.user.name}]</font>
									<c:if test="${not empty x.wishdate}">
										<font class="small">办理期限:&nbsp;<fmt:formatDate value="${x.wishdate}" pattern="yyyy-MM-dd HH:mm:ss"/></font>
									</c:if>
								</li>
							</c:forEach>
						</ul>
					</c:if>
					<c:if test="${count eq 0}">
						<div class="empty_content">没有新待办文件</div>
					</c:if>
				</div>
			</c:if>
			<c:if test="${x:combined(portal_mask, 2) and x:combined(modules, 2)}">
				<c:set var="count" value="${fn:length(docexFileInboxs)}" />
				<div class="item_title_bg">
					<a class="item_title_closed" href="javascript:void(0);" onclick="changePortal(this, 'item02');">协同工作</a>
					<font class="item_title_count">(${count})</font>
				</div>
				<div class="item_content" id="item02" style="display:none">
					<c:if test="${count gt 0}">
						<ul class="portal_item">
							<c:forEach items="${docexFileInboxs}" var="x">
								<li>
									<ff:ssolink cls="link_item" target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/docex/docexFile.do?method=inshow&id=${x.id}">${x.docexFile.title}</ff:ssolink>
									<c:if test="${x.isread eq 0}"><img src="${ctx_path}/client/images/new.gif" /></c:if>
									<font class="small">[${x.docexFile.user.name}]</font>
								</li>
							</c:forEach>
						</ul>
					</c:if>
					<c:if test="${count eq 0}">
						<div class="empty_content">没有新待办事项</div>
					</c:if>
				</div>
			</c:if>
			<c:if test="${x:combined(portal_mask, 4) and x:combined(modules, 4)}">
				<c:set var="count" value="${fn:length(knowledges)}" />
				<div class="item_title_bg">
					<a class="item_title_closed" href="javascript:void(0);" onclick="changePortal(this, 'item03');">知识中心</a>
					<font class="item_title_count">(${count})</font>
				</div>
				<div class="item_content" id="item03" style="display:none">
					<c:if test="${count gt 0}">
						<ul class="portal_item">
							<c:forEach items="${knowledges}" var="x">
								<c:set value="${x.knowledgeCatalogy}" var="catalogy" />
								<li>[${catalogy.name}]&nbsp;<ff:ssolink cls="link_item" target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/knowledge/knowledges.do?method=viewKnowledges&cid=${catalogy.id}&id=${x.id}">${x.title}</ff:ssolink></li>
							</c:forEach>
						</ul>
					</c:if>
					<c:if test="${count eq 0}">
						<div class="empty_content">没有新文章</div>
					</c:if>
				</div>
			</c:if>
			<c:if test="${x:combined(portal_mask, 8) and x:combined(modules, 8)}">
				<c:set var="count" value="${fn:length(bulletins)}" />
				<div class="item_title_bg">
					<a class="item_title_closed" href="javascript:void(0);" onclick="changePortal(this, 'item04');">通知公告</a>
					<font class="item_title_count">(${count})</font>
				</div>
				<div class="item_content" id="item04" style="display:none">
					<c:if test="${count gt 0}">
						<ul class="portal_item">
							<c:forEach items="${bulletins}" var="x">
								<li>
									<ff:ssolink cls="link_item" target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/bulletin/bulletins.do?method=show&id=${x.id}">${x.title}</ff:ssolink>
									<c:if test="${x.userRead eq 0}"><img src="<c:url value="/client/images/new.gif"/>"/></c:if>
									<c:if test="${not empty x.createdate}"><font class="small">&nbsp;<fmt:formatDate value="${x.createdate}" pattern="yyyy-MM-dd"/></font></c:if>
								</li>
							</c:forEach>
						</ul>
					</c:if>
					<c:if test="${count eq 0}">
						<div class="empty_content">没有新公告</div>
					</c:if>
				</div>
			</c:if>
			<c:if test="${x:combined(portal_mask, 16) and x:combined(modules, 16)}">
				<c:set var="count" value="${fn:length(newsList)}" />
				<div class="item_title_bg">
					<a class="item_title_closed" href="javascript:void(0);" onclick="changePortal(this, 'item05');">新闻中心</a>
					<font class="item_title_count">(${count})</font>
				</div>
				<div class="item_content" id="item05" style="display:none">
					<c:if test="${count gt 0}">
						<ul class="portal_item">
							<c:forEach items="${newsList}" var="x">
								<c:set value="${x.newsCatalogy}" var="catalogy" />
								<li>
									<c:if test="${x.newsImgStatus eq 1}">
										<ff:ssolink target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/news/news.do?method=show&cid=${catalogy.id}&id=${x.id}&close=true"><img style="border-style:none;" height="15" src="<c:url value="/client/images/img.gif"/>"/></ff:ssolink>
									</c:if>
									<ff:ssolink title="${fn:escapeXml(x.title)}" cls="link_item" target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/news/news.do?method=show&cid=${catalogy.id}&id=${x.id}&close=true">${x.title}</ff:ssolink>
									<img src="<c:url value="/client/images/new.gif"/>"/>
									<font class="small"><fmt:formatDate value="${x.createdate}" pattern="yyyy-MM-dd"/></font>
								</li>
							</c:forEach>
						</ul>
					</c:if>
					<c:if test="${count eq 0}">
						<div class="empty_content">没有新闻</div>
					</c:if>
				</div>
			</c:if>
			<c:if test="${x:combined(portal_mask, 32) and x:combined(modules, 32)}">
				<c:set var="count" value="${fn:length(tasks)}" />
				<div class="item_title_bg">
					<a class="item_title_closed" href="javascript:void(0);" onclick="changePortal(this, 'item06');">任务管理</a>
					<font class="item_title_count">(${count})</font>
				</div>
				<div class="item_content" id="item06" style="display:none">
					<c:if test="${count gt 0}">
						<ul class="portal_item">
							<c:forEach items="${tasks}" var="x">
								<c:set var="c" value="${fn:escapeXml(x.content)}" />
								<li>
									<ff:ssolink title="${c}" cls="link_item" target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/task/task.do?method=edit&type=mytask&id=${x.id}">${c}</ff:ssolink>
									<font class="small">[${x.user.name}]</font>
								</li>
							</c:forEach>
						</ul>
					</c:if>
					<c:if test="${count eq 0}">
						<div class="empty_content">没有待办任务</div>
					</c:if>
				</div>
			</c:if>
			<c:if test="${x:combined(portal_mask, 64) and x:combined(modules, 64)}">
				<c:set var="count" value="${fn:length(meetingUsers)}" />
				<div class="item_title_bg">
					<a class="item_title_closed" href="javascript:void(0);" onclick="changePortal(this, 'item07');">会议管理</a>
					<font class="item_title_count">(${count})</font>
				</div>
				<div class="item_content" id="item07" style="display:none">
					<c:if test="${count gt 0}">
						<ul class="portal_item">
							<c:forEach items="${meetingUsers}" var="x">
								<c:set var="m" value="${x.meetings}" />
								<li>
									<ff:ssolink cls="link_item" target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/meeting/meetings.do?method=show&meetingId=${m.id}&op=waitJoin&show=waitmeeting">${empty m.name ? "&nbsp;" : m.name}</ff:ssolink>
									<c:if test="${not empty m.userByEmceeuserId.name}"><font class="small">[${m.userByEmceeuserId.name}]</font></c:if>
									<c:if test="${not empty m.startday}">
										<font class="small">开始时间:&nbsp;<fmt:formatDate value="${m.startday}" pattern="yyyy-MM-dd"/>&nbsp;${m.starthour}:${m.startmenute}</font>
									</c:if>
								</li>
							</c:forEach>
						</ul>
					</c:if>
					<c:if test="${count eq 0}">
						<div class="empty_content">没有新会议安排</div>
					</c:if>
				</div>
			</c:if>
			<c:if test="${x:combined(portal_mask, 128) and x:combined(modules, 128)}">
				<c:set var="count" value="${fn:length(forumThreads)}" />
				<div class="item_title_bg">
					<a class="item_title_closed" href="javascript:void(0);" onclick="changePortal(this, 'item08');">在线论坛</a>
					<font class="item_title_count">(${count})</font>
				</div>
				<div class="item_content" id="item08" style="display:none">
					<c:if test="${count gt 0}">
						<ul class="portal_item">
							<c:forEach items="${forumThreads}" var="x">
								<c:set var="forum" value="${x.forums}" />
								<li>
									<ff:ssolink cls="link_item" target="F1OAWINDOW" title="${fn:escapeXml(x.threadtopic)}" reqFrom="oa" nexturl="/modules/forum/forumThread.do?method=show&id=${x.id}&forumId=${forum.id}&postwin=true">${x.threadtopic}</ff:ssolink>&nbsp;[${fn:escapeXml(forum.forumname)}]
								</li>
							</c:forEach>
						</ul>
					</c:if>
					<c:if test="${count eq 0}">
						<div class="empty_content">没有新帖子</div>
					</c:if>
				</div>
			</c:if>
			<c:if test="${x:combined(portal_mask, 256) and x:combined(modules, 256)}">
				<form width="0" height="0" style="display:none" id="ec" action="<c:url value="/modules/ballot/ballotQuestionnaire.do?method=ballotQuery&ec_s_sysDate=desc"/>" method="post">
				</form>
				<c:set var="count" value="${fn:length(ballots)}" />
				<div class="item_title_bg">
					<a class="item_title_closed" href="javascript:void(0);" onclick="changePortal(this, 'item09');">问卷调查</a>
					<font class="item_title_count">(${count})</font>
				</div>
				<div class="item_content" id="item09" style="display:none">
					<c:if test="${count gt 0}">
						<ul class="portal_item">
							<c:forEach items="${ballots}" var="x">
								<c:set var="url_title">${ctx_path}/login/kingdee_sso_login.jsp?DSESSIONID=${sessionid}&from=oahelper&reqFrom=oa&nexturl=<x:urlencode url="/modules/ballot/ballotQuestionnaire.do?method=show&id=${x.id}&isDegree=${x.isDegree}&tagger=show&openwin=true&from=ucstar"/></c:set>
								<c:set var="url_image">${ctx_path}/login/kingdee_sso_login.jsp?DSESSIONID=${sessionid}&from=oahelper&reqFrom=oa&nexturl=<x:urlencode url="/modules/ballot/ballotQuestionnaire.do?method=getBallotResult&paperId=${x.id}&openwin=true&from=ucstar"/></c:set>
								<c:if test="${x.onlySee eq 1}">
									<li>
										${x.title}&nbsp;[${x.ballotType.typeName}]
										<img src="${ctx_path}/client/images/vote.gif" align="absmiddle" style="cursor:hand;" onClick="javascript:openwin('${url_image}',100,100,800,450,'yes');" />
										<%--<img src="${ctx_path}/client/images/archive_export.gif" align="absmiddle" style="cursor:hand;" onClick="javascript:openwin('${url_excel}',100,100,800,450,'yes');" />--%>
										<ff:ssolink target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/ballot/ballotQuestionnaire.do?method=getBallotResultExcel&paperId=${x.id}&from=ucstar"><img align="absmiddle" style="border-style:none;" src="${ctx_path}/client/images/archive_export.gif"/></ff:ssolink>
									</li>
								</c:if>
								<c:if test="${x.onlySee ne 1}">
									<li>
										<a class="link_item" href="#" onclick="javascript:openwinCanResize('${url_title}',100,100,730,480,'yes');">${x.title}</a>&nbsp;[${x.ballotType.typeName}]
										<c:if test="${x.isResultShow eq 1}">
											<img src="${ctx_path}/client/images/vote.gif" align="absmiddle" style="cursor:hand" onClick="javascript:openwin('${url_image}',100,100,800,450,'yes');" />
										</c:if>
										<c:set var="ep" value="0" />
										<c:forTokens var="u" items="${x.result_users}" delims=",">
											<c:if test="${u eq user.id}">
												<c:set var="ep" value="${ep + 1}" />
											</c:if>
										</c:forTokens>
										<c:if test="${ep gt 0}">
											<ff:ssolink target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/ballot/ballotQuestionnaire.do?method=getBallotResultExcel&paperId=${x.id}&from=ucstar"><img align="absmiddle" style="border-style:none;" src="${ctx_path}/client/images/archive_export.gif"/></ff:ssolink>
										</c:if>
										<c:if test="${x.isResultShow eq 0}">
											<font color="#0000c0">暂不能查看</font>
										</c:if>
									</li>
								</c:if>
							</c:forEach>
						</ul>
					</c:if>
					<c:if test="${count eq 0}">
						<div class="empty_content">没有问卷调查</div>
					</c:if>
				</div>
			</c:if>
			<c:if test="${x:combined(portal_mask, 512) and x:combined(modules, 512)}">
				<c:set var="count" value="${fn:length(emails)}" />
				<div class="item_title_bg">
					<a class="item_title_closed" href="javascript:void(0);" onclick="changePortal(this, 'item10');">电子邮件</a>
					<font class="item_title_count">(${count})</font>
				</div>
				<div class="item_content" id="item10" style="display:none">
					<c:if test="${count gt 0}">
						<ul class="portal_item">
							<c:forEach items="${emails}" var="x">
								<c:set var="stateImg" value="seen.gif" />
					       		<c:if test="${x.isseen eq 0}">
					       			<c:set var="stateImg" value="unseen.gif" />
					       		</c:if>
					       		<c:if test="${x.isseen eq 1}">
					       			<c:if test="${x.isanswer==1 && x.isflagged!=1}">
						       			<c:set var="stateImg" value="answer.gif" />
						       		</c:if>
						       		<c:if test="${x.isflagged==1 && x.isanswer!=1}">
						       			<c:set var="stateImg" value="flagged.gif" />
						       		</c:if>
						       		<c:if test="${x.isflagged==1 && x.isanswer==1}">
						       			<c:set var="stateImg" value="flagged_answer.gif" />
						       		</c:if>	
					       		</c:if>
					   			<c:if test="${x.isdraft==1}">
					    			<c:set var="stateImg" value="draft.gif" />
					   			</c:if>
								<li>
									<img src="${ctx_path}/client/images/mail_${stateImg}" />
									<ff:ssolink cls="link_item" target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/email2/email2.do?method=show&id=${x.id}&query=">${x.title}</ff:ssolink>
									<font class="small">
										<ff:ssolink cls="link_item" target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/email2/email2.do?method=show&id=${x.id}&query=">[${x.form}]</ff:ssolink>
									</font>
								</li>
							</c:forEach>
						</ul>
					</c:if>
					<c:if test="${count eq 0}">
						<div class="empty_content">没有新邮件</div>
					</c:if>
				</div>
			</c:if>
		</div>
	</div>
</body>
</html>